﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SMSMTROUTER.Business;

namespace SMSMTROUTER
{
    public partial class FrmRouter : Form
    {
        public FrmRouter()
        {
            InitializeComponent();
            grvRouter.DataSource = SmsRouter.GetInstance();
        }

        private void grvRouter_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            SmsRouter current = (sender as DataGridView).CurrentRow.DataBoundItem as SmsRouter;
            if (current != null)
            {
                FrmEditRouter frmEdit = new FrmEditRouter(current);
                frmEdit.Change += new FrmEditBase.OnChange(frmEdit_Change);
                frmEdit.ShowDialog();
            }
        }

        void frmEdit_Change()
        {
            SmsRouter.ReloadData();
            grvRouter.DataSource = SmsRouter.GetInstance();
        }
    }
}
